<template>
    <div class="father">
        <h2>我是父组件</h2>
        <h4>汽车： {{ car }}</h4>
        <h4 v-if="toy">子组件给的玩具：{{ toy }}</h4>
        <Child :che="car" :getFromToy="getToy"/>
    </div>
</template>

<script lang="ts" setup name="Father">
import Child from "@/components/Child.vue";
import {ref} from "vue";

let car = ref('奔驰')
let toy = ref('')
function getToy(val) {
    toy.value = val
}
</script>

<style scoped>
.father {
    height: 500px;
    background-color: aqua;
}
</style>
